package sample;

import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXCheckBox;
import com.jfoenix.controls.JFXTextArea;
import javafx.event.ActionEvent;
import javafx.event.Event;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;

import java.net.URL;
import java.util.ResourceBundle;

public class Controller implements Initializable {

    @FXML
    private JFXCheckBox ck1;

    @FXML
    private JFXCheckBox ck2;

    @FXML
    private JFXTextArea tx1;

    @FXML
    private JFXButton b1;

    @FXML
    private ImageView im1;


    public Controller() {}

    @FXML
    protected void ck1OnAction(Event event) {
        if(ck1.isSelected()) {
            tx1.appendText("Selected\n");
            Image image = new Image("http://git.oschina.net/uploads/22/488722_mjchow.png");
            im1.setImage(image);
        } else {
            tx1.appendText("UnSelected\n");
            im1.setImage(null);
        }
    }

    @FXML
    protected void b1OnAction(ActionEvent event) {
        tx1.clear();
    }

    @Override
    public void initialize(URL location, ResourceBundle resources) {

    }
}
